import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/home'
import Color from '@/components/Color'
import NotFound from '@/components/404'
import Test from '@/components/Test'
import Film from '@/views/film'
import Cinema from '@/views/cinema'
import CinemaList from '@/views/cinema/children/list'
import CinemaDetail from '@/views/cinema/children/detail'
import NowPlaying from '@/views/film/children/now-playing'
import ComingSoon from '@/views/film/children/coming-soon'
import FilmDetail from '@/views/film/children/detail'

import Account from '@/views/account'
import AccountMy from '@/views/account/children/my'
import Login from '@/views/account/children/login'
import City from '@/views/city'

// demos
import Demos from '@/demos/index'
import Filter from '@/demos/children/filter'

Vue.use(Router)


const router = new Router({
    routes: [
        {
            path: '/demos',
            name: 'demos',
            component: Demos,
            children: [
                {
                    path: 'filter',
                    name: '过滤器',
                    component: Filter
                }
             ]
		},
        {
        	// 根路由配置
            path: '/',
            name: 'index',
            component: Home
		},
        {
            path: '/color',
            name: 'color',
            component: Color
		},
        {
            path: '/city',
            name: 'city',
            component: City
		},
        {
        	// 影院模块配置
            path: '/cinema',
            name: 'cinema',
            component: Cinema,
            redirect: '/cinema/list',
            children: [
                {
                    path: 'list',
                    name: 'cinema-list',
                    component: CinemaList
               },
                {
                	// 动态路由配置
                    path: 'detail/:id',
                    name: 'cinema-detail',
                    component: CinemaDetail
               }
            ]
		},
        {
            path: '/film',
            name: 'film',
            component: Film,
            redirect: '/film/now-playing',
            children: [
                {
                    path: 'now-playing',
                    name: 'now-playing',
                    component: NowPlaying
                }, {
                    path: 'coming-soon',
                    name: 'coming-soon',
                    component: ComingSoon
                }

            ]
        },
        {
            path: '/film/detail/:id',
            component: FilmDetail
        },
        {
            path: '/account',
            name: 'account',
            component: Account,
            redirect: '/account/my',
            children: [
                {
                    path: 'my',
                    name: 'account-my',
                    component: AccountMy
                },
                {
                    path: 'login',
                    name: 'login',
                    component: Login
                }
            ]
        },
        {
            /*404配置*/
            path: '*',
            component: NotFound
        }
	]
})

export default router;
